package com.slliver.baoxinsap.interceptor;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

/**
 * 如果在请求接口时就需要账号密码怎么设置？
 * 编写鉴权配置器
 */

public class MyAuthenticator extends Authenticator {

    private String username;
    private String password;

    public MyAuthenticator(String username, String password) {
        this.username = username;
        this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication("IF_ALL","123456".toCharArray());
    }

}
